home *** CD-ROM | disk | FTP | other *** search
- package symantec.itools.lang;
-
- import java.applet.Applet;
- import java.net.MalformedURLException;
- import java.net.URL;
-
- public class Context {
- private static Applet applet;
- private static URL documentBase;
- private static boolean initialized;
-
- public static boolean isApplet() {
- return applet != null;
- }
-
- public static boolean isApplication() {
- return applet == null;
- }
-
- public static void setApplet(Applet var0) {
- applet = var0;
- initialized = true;
- }
-
- public static Applet getApplet() {
- return applet;
- }
-
- public static void setDocumentBase(URL var0) {
- documentBase = var0;
- initialized = true;
- }
-
- private static void initializeApp() {
- StringBuffer var0 = new StringBuffer(System.getProperty("user.dir"));
- int var1 = var0.length();
-
- try {
- char var2 = System.getProperty("file.separator").charAt(0);
- if (var2 != '/') {
- for(int var3 = 0; var3 < var1; ++var3) {
- if (var2 == var0.charAt(var3)) {
- var0.setCharAt(var3, '/');
- }
- }
- }
- } catch (StringIndexOutOfBoundsException var5) {
- }
-
- try {
- documentBase = new URL("file://" + var0 + "/");
- } catch (MalformedURLException var4) {
- }
- }
-
- public static URL getDocumentBase() {
- if (!initialized) {
- initializeApp();
- initialized = true;
- }
-
- if (documentBase != null) {
- return documentBase;
- } else {
- return applet != null ? applet.getDocumentBase() : null;
- }
- }
- }
-